From: Kim F. Storm Date: Mon, 21 Jun 2004 21:52:46 +0000 (+0000) Subject: (Fstring): Use SAFE_ALLOCA. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~21886 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=03887efe50367e220fccdb96663929b85c3321dd;p=emacs.git (Fstring): Use SAFE_ALLOCA. --- diff --git a/src/charset.c b/src/charset.c index 57a12b2398d..8eeddd51c92 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1645,11 +1645,16 @@ usage: (string &rest CHARACTERS) */) int n; Lisp_Object *args; { - int i; - unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n); - unsigned char *p = buf; + int i, bufsize; + unsigned char *buf, *p; int c; int multibyte = 0; + Lisp_Object ret; + USE_SAFE_ALLOCA; + + bufsize = MAX_MULTIBYTE_LENGTH * n; + SAFE_ALLOCA (buf, unsigned char *, bufsize); + p = buf; for (i = 0; i < n; i++) { @@ -1667,7 +1672,10 @@ usage: (string &rest CHARACTERS) */) *p++ = c; } - return make_string_from_bytes (buf, n, p - buf); + ret = make_string_from_bytes (buf, n, p - buf); + SAFE_FREE (bufsize); + + return ret; } #endif /* emacs */